UNPKG

marko

Version:

UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.

22 lines (19 loc) 830 B
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.default = _default;var _babelUtils = require("@marko/compiler/babel-utils"); var _vdomOutWrite = _interopRequireDefault(require("../util/vdom-out-write")); var _withPreviousLocation = _interopRequireDefault(require("../util/with-previous-location")); function _default(path) { const { node } = path; const { escape, value } = node; const method = escape ? "t" : "h"; const computed = (0, _babelUtils.computeNode)(value); if (computed && computed.value == null) { path.remove(); } else { path.replaceWith( (0, _withPreviousLocation.default)( (0, _vdomOutWrite.default)(method, value, path.hub.file._componentInstanceIdentifier), node ) ); } }